home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / glass / glass.lha / GLASS / widgets / KindBox.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-01  |  1.3 KB  |  60 lines

  1. /*
  2.    File: KindBox.c
  3.    Implements a nice form widget
  4. */
  5. #include <X11/Intrinsic.h>
  6. #include <X11/StringDefs.h>
  7. #include <X11/Xaw/Form.h>
  8. #include "XtArgs.h"
  9. #include "KindBox.h"
  10.  
  11. static Widget current;
  12. static Widget last_added, last_layer;
  13. static WidgetClass last_class;
  14.  
  15. Widget CreateKindBox (name, parent)
  16.  String name;
  17.  Widget parent;
  18.     { current = XtCreateManagedWidget (name, formWidgetClass,
  19.                     parent, NoArgs);
  20.       last_added = NULL;
  21.       last_layer = NULL;
  22.       last_class = NULL;
  23.       return (current);
  24.     }
  25.  
  26. void AddToKindBox (w)
  27.  Widget w;
  28.     { WidgetClass this_class = XtClass(w);
  29.       if (this_class == last_class)
  30.          { /* Chain horizontal */
  31.            StartArgs;
  32.            SetArg (XtNfromHoriz, last_added);
  33.            XtSetValues (w, UseArgs);
  34.          }
  35.       else
  36.          { /* Finish Previous Layer */
  37.            if (last_added != NULL)
  38.           { /* Chain last widget to form */
  39.                 StartArgs;
  40.                 SetArg (XtNright, XtChainRight);
  41.                 XtSetValues (last_added, UseArgs);
  42.               };
  43.            last_layer = last_added;
  44.          };
  45.     
  46.       StartArgs;
  47.       SetArg (XtNfromVert, last_layer);
  48.       XtSetValues (w, UseArgs);
  49.     
  50.       last_added = w;
  51.       last_class = this_class;
  52.     };
  53.  
  54. void DoneKindBox()
  55.     { /* Chain last widget right to form */
  56.       StartArgs;
  57.       SetArg (XtNright, XtChainRight);
  58.       XtSetValues (last_added, UseArgs);
  59.     }
  60.